load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "kvfollowerreadsccl",
    srcs = [
        "boundedstaleness.go",
        "followerreads.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/ccl/kvccl/kvfollowerreadsccl",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/ccl/utilccl",
        "//pkg/kv",
        "//pkg/kv/kvclient/kvcoord",
        "//pkg/kv/kvpb",
        "//pkg/kv/kvserver",
        "//pkg/kv/kvserver/closedts",
        "//pkg/roachpb",
        "//pkg/settings",
        "//pkg/settings/cluster",
        "//pkg/sql",
        "//pkg/sql/pgwire/pgcode",
        "//pkg/sql/pgwire/pgerror",
        "//pkg/sql/physicalplan/replicaoracle",
        "//pkg/sql/sem/asof",
        "//pkg/sql/sem/builtins",
        "//pkg/sql/sem/eval",
        "//pkg/sql/sqlerrors",
        "//pkg/util/duration",
        "//pkg/util/hlc",
        "//pkg/util/randutil",
        "@com_github_cockroachdb_errors//:errors",
    ],
)

go_test(
    name = "kvfollowerreadsccl_test",
    size = "medium",
    srcs = [
        "boundedstaleness_test.go",
        "followerreads_test.go",
        "main_test.go",
    ],
    data = glob(["testdata/**"]),
    embed = [":kvfollowerreadsccl"],
    exec_properties = select({
        "//build/toolchains:is_heavy": {"test.Pool": "large"},
        "//conditions:default": {"test.Pool": "default"},
    }),
    deps = [
        "//pkg/base",
        "//pkg/ccl",
        "//pkg/ccl/utilccl",
        "//pkg/keys",
        "//pkg/kv",
        "//pkg/kv/kvbase",
        "//pkg/kv/kvclient/kvcoord",
        "//pkg/kv/kvpb",
        "//pkg/kv/kvserver",
        "//pkg/kv/kvserver/closedts",
        "//pkg/kv/kvserver/concurrency/lock",
        "//pkg/kv/kvserver/kvserverbase",
        "//pkg/roachpb",
        "//pkg/rpc",
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/server",
        "//pkg/server/serverpb",
        "//pkg/settings/cluster",
        "//pkg/sql",
        "//pkg/sql/physicalplan/replicaoracle",
        "//pkg/sql/sem/eval",
        "//pkg/testutils",
        "//pkg/testutils/datapathutils",
        "//pkg/testutils/serverutils",
        "//pkg/testutils/skip",
        "//pkg/testutils/sqlutils",
        "//pkg/testutils/testcluster",
        "//pkg/util",
        "//pkg/util/hlc",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/randutil",
        "//pkg/util/stop",
        "//pkg/util/syncutil",
        "//pkg/util/tracing",
        "//pkg/util/tracing/tracingpb",
        "@com_github_cockroachdb_datadriven//:datadriven",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_stretchr_testify//require",
    ],
)
